package ru.spb.osll.myfit.common;

import com.google.gwt.user.client.ui.Anchor;
import com.thoughtworks.xstream.annotations.XStreamAlias;

import java.io.Serializable;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.TreeMap;

@XStreamAlias("executionResult")
public abstract class ExecutingResult implements Serializable {
  private static final long serialVersionUID = -3681670637439993509L;

  public enum ExecutingState {
    PROGRESS, FINISH, NOT_STARTED, FAIL
  }

  @XStreamAlias("id")
  protected String m_id;

  @XStreamAlias("state")
  protected ExecutingState m_state = ExecutingState.NOT_STARTED;

  @XStreamAlias("startTime")
  protected Date m_startTime;

  @XStreamAlias("metadata")
  protected Map<String, String> m_metadata = new TreeMap<String, String>();

  @XStreamAlias("name")
  protected String m_name;

  public String getName() {
    return m_name;
  }

  public void setName(String pageName) {
    m_name = pageName;
  }

  public String getId() {
    return m_id;
  }

  public void setId(String m_id) {
    this.m_id = m_id;
  }

  public Date getStartTime() {
    return m_startTime;
  }

  public void setStartTime(Date time) {
    m_startTime = time;
  }

  public ExecutingState getState() {
    return m_state;
  }

  public void setState(ExecutingState newState) {
    m_state = newState;
  }

  public Map<String, String> getMetadata() {
    return m_metadata;
  }

  public void setMetadata(Map<String, String> metadata) {
    m_metadata = metadata;
  }

  public abstract String getStatusString();
  public abstract boolean isWrong();
  public abstract Anchor getLink();
  public abstract double getPercentage();
  public abstract List<Table> getExecutedTables();
}
